#include "../source/json_util.hpp"
#include <iostream>

int main()
{
    Json::Value root_in;
    root_in["name"] = "张三";
    root_in["age"] = 19;
    root_in["sorce"].append(88.8);
    root_in["sorce"].append(46.8);
    root_in["sorce"].append(79.3);

    std::string ser;
    if (Util::json::serialize(root_in, &ser))
    {
        std::cout << "序列化结果：\n"
              << ser << std::endl;
    }

    Json::Value root_out;
    if (Util::json::deserialize(&root_out, ser))
    {
        std::cout << "反序列化结果：\n"
              << "name:" << root_out["name"].asString() << std::endl
              << "age:" << root_out["age"].asInt() << std::endl
              << "sorce: " << root_out["sorce"][0].asDouble() << ", " << root_out["sorce"][1].asUInt() << ", " << root_out["sorce"][2].asFloat() << std::endl;
    }
    
    return 0;
}